{extend name="base_mobile" /}
{block name="css"}
<link rel="stylesheet" href="__CSS__/fonts.css">
{/block}
{block name="body"}
<header class="hui-header">
    <div id="hui-back"></div>
    <div id="hui-header-sreach">
    	<div id="hui-header-sreach-icon"></div>
            <form action="{:url('user/customer/index')}" class="layui-form" method="get">
                <input type="text" name="cname" id="searchKey" value="{:input('cname')}" autocomplete="off" placeholder="请输入客户名称" onkeydown="if(event.keyCode==13)return false;"  class="layui-input"/>
                <button class="layui-btn layui-btn-primary ajax-search"><i class="fa fa-search"></i></button>
            </form>
    </div>
    <div id="hui-header-menu" onclick="hui.showSlideMenu();"></div>
</header>
<div class="hui-wrap">
    <div class="hui-list" style="margin-top:18px;">
        {foreach name="list" item="v" empty="$empty"}
        <a href="javascript:hui.open('{:url('user/customer/show', ['id' => $v.id])}');">
            <div class="hui-list-icons">
                <img src="/static/hui/img/index/account.png" />
            </div>
            <div class="hui-list-text" style="font-weight: bold;">
                {$v.cname}
                <div class="hui-list-info">
                    {:user_config_toval('intention',$v['intention'],'customer')}
                    <span class="hui-icons hui-icons-right"></span>
                </div>
            </div>
        </a>
        <a href="javascript:hui.open('{:url('user/customer/show', ['id' => $v.id])}');">
            <div style="font-size:13px;color:#898989;padding-left:20px;padding-top:5px;line-height: 22px;">
                {:user_config_toval('type',$v['type'],'customer')} / {:user_config_toval('come_from',$v['come_from'],'customer')} / {:user_config_toval('status',$v['status'],'customer')}
                <br>{:get_user_realname($v['uid'])} : {:time_trans($v['update_time'])}
            </div>
        </a>
        <div style="padding-top:5px;">
            <a href="tel:{$v.mobile}" class="hui-button hui-button-small hui-fl" style="width:25%"><i class="fa fa-phone"></i> 打电话</a>
            <a href="javascript:hui.open('{:url('user/customer/add_track', ['id' => $v.id])}');" class="hui-button hui-button-small hui-fl" style="width:25%"><i class="fa fa-check-square-o"></i> 写跟进</a>
            <a href="javascript:hui.open('{:url('user/customer/add_remind', ['id' => $v.id])}');" class="hui-button hui-button-small hui-fl" style="width:25%"><i class="fa fa-clock-o"></i> 设提醒</a>
            <a href="javascript:hui.open('{:url('user/customer/show', ['id' => $v.id])}');" class="hui-button hui-button-small hui-fl" style="width:25%"><i class="fa fa-ellipsis-h"></i> 更多</a>
        </div>
        {/foreach}
    </div>
    <div class="page" style="margin-bottom: 70px;">{$list->mobile_render()}</div>
</div>
{/block}
{block name="js"}
<script type="text/javascript">
//监听搜索事件
document.getElementById('searchKey').addEventListener('keyup', function(e){if(e.keyCode == 13){searchNow();}});
function hotSearch(k){
	hui('#searchKey').val(k);
	searchNow();
}
//核心搜索函数
function searchNow(){
	document.activeElement.blur();
	var kwd = hui('#searchKey').val();
	kwd = kwd.trim();
	if(kwd.length < 2){
		hui.toast('关键字至少2个字符');
		hui('.hui-hot-sreach').show();
		return;
	}
	//关闭热搜
	hui.open('{:url('user/customer/index')}?cname='+ kwd);
}
//清空
function clearSearch(){
	hui('#searchKey').val('');
	hui('.hui-hot-sreach').show();
}
</script>
{/block}